<template>
    <view class="globe_back">
        <view class="box">
            <view class="back_fff f_28 info">
                <view class="flex list">
                    <view class="title">客户电话</view>
                    <view>18152145215</view>
                </view>
                <view class="flex list">
                    <view class="title">客户地址</view>
                    <view>贵阳市南明区花果园金融街1号1824</view>
                </view>
                <view class="flex list">
                    <view class="title">车辆品牌</view>
                    <view>
                        <input type="text" placeholder="请填写用户电动车品牌" />
                    </view>
                </view>
                <view class="flex list">
                    <view class="title">车龄</view>
                    <view class="flex justify_content_between" style="width: 75%">
                        <input type="text" placeholder="请填写用户电动车车龄" />
                        <text>月</text>
                    </view>
                </view>
            </view>
            <!-- 车况信息 -->
            <view class="store">
                <view class="f_28">车况信息</view>
                <textarea class="f_28 mt-20" name="" id="" cols="30" rows="10" placeholder="在这里输入车况信息"></textarea>
                <view>
                    <view class="flex flex-wrap">
                        <view v-if="images.length > 0" v-for="(item, i) in images">
                            <image class="storeImg" :src="item" mode="widthFix"></image>
                            <view class="imm_delete" @click="deletephotos(i)">
                                <image class="icon_ljt" :src="url + 'icon_sc.png'"></image>
                            </view>
                        </view>
                        <view class="img_add" style="display: inline-block" v-if="images.length < maxImagesNum" @click="instoreImages">
                            <image :src="url + 'updata-img.png'" mode="" style="width: 100%; height: 100%"></image>
                        </view>
                    </view>
                </view>
            </view>
        </view>
        <view class="addBtn back_3377FF br_24 cl_fff mt_24">提交工单</view>
    </view>
</template>

<script>
import { common } from '@/common/serve.js';
export default {
    data() {
        return {
            maxImagesNum: 6,
            images: [],
            url: ''
        };
    },
    onShow() {
        this.url = this.baseUrl + this.imgPath;
    },
    methods: {
        // 删除现场照片
        deletephotos(i) {
            this.images.splice(i, 1);
        },
        // 现场照片
        async instoreImages() {
            let images = this.images;
            let num = this.maxImagesNum - images.length; //图片长度

            const result = await common.chooseImage(num).catch((err) => console.log('chooseImageErrMsg:', err));
            const suceessList = (result || []).filter((item) => item.isSuccess === true);
            if (suceessList.length > 0) {
                suceessList.map((item) => {
                    images.push(item.path);
                });

                this.images = images;
            }
        }
    }
};
</script>

<style scoped lang="scss">
.box {
    padding: 32rpx;
}
.store {
    background: white;
    border-radius: 24rpx;
    padding: 32rpx 24rpx;
}
.storeImg {
    width: 96rpx;
    height: 96rpx;
    border-radius: 16rpx;
    margin-right: 16rpx;
}
.img_add {
    width: 140rpx;
    height: 140rpx;
}
.title {
    width: 148rpx;
}
.list {
    padding: 32rpx 0;
}
.info {
    padding: 0 24rpx;
    border-radius: 24rpx;
    margin-bottom: 24rpx;
}
.addBtn {
    width: 686rpx;
    height: 100rpx;
    line-height: 100rpx;
    text-align: center;
    margin: 24px auto;
}
</style>
